<template>
  <div class="test-tips">临时使用</div>
  <a-form :model="form" :style="{ width: '600px' }" @submit="onSubmit" style="margin-top: 10px">
    <a-form-item tooltip="User Id" label="用户ID">
      <a-input v-model="form.userId" placeholder="请输入指定用户的ID" />
    </a-form-item>
    <a-form-item label="用户名">
      <a-input v-model="form.userName" placeholder="用户名，首次开户时需要用到" />
    </a-form-item>
    <a-form-item label="备注">
      <a-input v-model="form.remarks" placeholder="请输入备注" />
    </a-form-item>
    <a-form-item label="金额">
      <a-input-number v-model="form.amount" :style="{ width: '320px' }" placeholder="请输入金额" :min="0.01" :max="9999" />
    </a-form-item>
    <a-form-item label="类型">
      <select v-model="form.walletType">
        <option value="amb-cost-cny">成本账户(不可提现)</option>
        <option value="amb-profit-cny">利润账户(可提现)</option>
      </select>
    </a-form-item>
    <a-form-item>
      <a-button html-type="submit">确认存入</a-button>
    </a-form-item>
  </a-form>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { walletDeposit } from '@/api/finance/wallet'
import { Message } from '@arco-design/web-vue'

let form: any = ref({ walletType: 'amb-cost-cny', amount: 0 })
const onSubmit = async () => {
  if (form.value.amount <= 0) {
    Message.error('金额不正确')
    return
  }
  let rs = await walletDeposit({ userId: form.value.userId, userName: form.value.userName, walletType: form.value.walletType, remarks: form.value.remarks, amount: form.value.amount })
  Message.success('存入成功')
  form.value.amount = 0
}
</script>

<style lang="less" scoped>
.test-tips {
  color: red;
  font-size: 30px;
  margin-left: 180px;
  margin-top: 30px;
}
</style>